package org.example.controller;


import lombok.extern.slf4j.Slf4j;
import org.example.model.ProductInfo;
import org.example.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/product")
@RestController
@Slf4j
public class ProductController {
    @Autowired
    private ProductService productService;

    @RequestMapping("/{id}")
    public ProductInfo selectProductByid(@PathVariable("id") Integer id) {
        log.info("Select product by id: " + id);
        return productService.selectProductById(id);
    }
}
